package Utils 
{
	import flash.display.MovieClip;
	import flash.display.Stage;
	import flash.geom.Vector3D;
	import flash.media.SoundChannel;
	import flash.media.SoundTransform;

	/**
	 * ...
	 * @author Victor Cruz
	 */
	public class Util 
	{
		/**
		 * Convert milliseconds to seconds
		 * @param	milliseconds -> a value to be converted
		 * @return the seconds that corresponds with the given milliseconds
		 */
		public static function convertMillisecondsToSeconds(milliseconds:Number):Number
		{
			return milliseconds / 1000;
		}
		
		/**
		 * Convert seconds to milliseconds
		 * @param	seconds -> a value to be converted
		 * @return the milliseconds that corresponds with the given seconds
		 */
		public static function convertSecondsToMilliseconds(seconds:Number):Number
		{
			return seconds * 1000;
		}
		
		/**
		 * Convert seconds to frames
		 * @param	seconds -> the value to be converted
		 * @param	frameRate -> the frameRate of the game
		 * @return the frames that corresponds with the given seconds
		 */
		public static function convertSecondsToFrames(seconds:Number, frameRate:Number):int
		{
			// one second corresponds to the total frame rate
			return seconds * frameRate;
		}
		
		/**
		 * Convert milliseconds to frames
		 * @param	milliSeconds -> the value to be converted
		 * @param	frameRate -> the frameRate of the game
		 * @return the frames that corresponds with the given milliseconds
		*/
		public static function convertMillisecondsToFrames(milliseconds:Number, frameRate:int):int
		{
			var seconds:int = convertMillisecondsToSeconds(milliseconds);
			return convertSecondsToFrames(seconds, frameRate);
		}
		
		/**
		 * Convert frames to milliseconds
		 * @param	frames -> the value to be converted
		 * @param	frameRate -> the frameRate of the game
		 * @return the milliseconds that corresponds with the given milliseconds
		 */
		public static function convertFramesToMilliseconds(frames:int, frameRate:int):Number
		{
			var seconds:int = frames / frameRate;
			return convertSecondsToMilliseconds(seconds);
		}
		
		public static function Volume(channel:SoundChannel):void 
		{
			/*if (Main.isMuted)
				channel.soundTransform = new SoundTransform(0);
			else
			{
				//channel.soundTransform = new SoundTransform(1);
			}*/
		}
	}
}